<template>
  <div class="content">
    <el-form
      ref="form"
      :model="form"
      label-width="90px"
    >
      <el-row>
        <el-col :span="18">
          <el-form-item label="操作时间段">
            <el-date-picker
              v-model="form.starttime"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
              style="width: 170px;"
            ></el-date-picker>~
            <el-date-picker
              v-model="form.endtime"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
              style="width: 170px;"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col
          :span="6"
          style="text-align: right;"
        >
          <el-button
            type="primary"
            style="width: 120px;"
            @click="query"
          >查询</el-button>
        </el-col>
      </el-row>
    </el-form>
    <el-row class="two_el_row">
      <el-col :span="18">
        <div style="width:100px;height:2px"></div>
      </el-col>
      <el-col :span="6">
        <div
          class="lowerBrick fr"
          @click="lowerBrick"
        >
          <img
            src="../../../assets/img/lowerBrick.png"
            alt
            style="margin-right:6px"
          >
          <span>下钻</span>
        </div>
      </el-col>
    </el-row>

    <div class="tableBox posting_box_list">
      <el-table
        :data="tableData"
        stripe
        style="width: 100%"
        v-loading="loading"
        border
      >
        <template v-for="(item,index) in allData">
          <el-table-column
            :key="index"
            v-if="item.value=='name'"
            :label="item.label"
            align="center"
          >
            <template slot-scope="scope">
              <span
                @click="handleClickNickName(scope.row)"
                style="color: #6b97eb;cursor: pointer;"
              >{{scope.row.name}}</span>
            </template>
          </el-table-column>
          <el-table-column
            :key="index"
            :prop="item.value"
            v-if="item.value!=='opt' && item.value!=='name' && item.value!='companyname'"
            :label="item.label"
            align="center"
          ></el-table-column>
          <el-table-column
            :key="index"
            v-if="item.value=='companyname'"
            :label="item.label"
            align="center"
          >
            <template slot-scope="scope">
              <span
                @click="handleClickCompanyName(scope.row)"
                style="color: #6b97eb;cursor: pointer;"
              >{{scope.row.companyname}}</span>
            </template>
          </el-table-column>
          <el-table-column
            :key="item.value"
            v-else-if="item.value=='opt'"
            label="操作"
            min-width="100px"
            align="center"
          >
            <template slot-scope="scope">
              <el-button
                @click="lookLog(scope.row)"
                type="text"
                size="small"
              >查看日志</el-button>
            </template>
          </el-table-column>
        </template>
      </el-table>
    </div>
    <div
      style="padding:20px 0"
      v-if="tableData.length>0"
    >
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="ScheduleCurrentChange"
        :current-page="pages.pagenum"
        :page-sizes="[10,20, 30, 50,100]"
        :page-size="pages.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pages.total"
        background
      ></el-pagination>
    </div>
    <el-dialog
      :visible.sync="showLog"
      width="1024px"
      custom-class="showlog"
    >
      <showLog :reportid="reportId"></showLog>
    </el-dialog>
    <el-dialog
      :visible.sync="dialoghyVisible"
      width="1040px"
    >
      <resume-detail
        v-if="dialoghyVisible"
        :userid="userid"
        :nickName="nickName"
        :isShowTelphone="true"
      ></resume-detail>
    </el-dialog>
    <el-dialog
      :visible.sync="dialogVisible2"
      width="1040px"
    >
      <company-detail
        v-if="dialogVisible2"
        :companyName="companyname"
        :companyId="companyid"
        :type="'0'"
        :tabNum="'4'"
      ></company-detail>
    </el-dialog>
  </div>
</template>
<script>
import showLog from "../../backlog/showLog.vue";
import resumeDetail from "../../../component/resumeDetail/index.vue";
// import companyDetail from '../../../component/companyDetail/index.vue';
import companyDetail from "../../socical/socialCheck/check.vue";
export default {
  data () {
    return {
      tableData: [],
      loading: false,
      allData: [],
      pages: {
        pagesize: 10,
        total: 0,
        pagenum: 1,
      },
      companyType: '',//上报type
      reportId: '',//上报id
      showLog: false,
      form: {
        starttime: '',
        endtime: '',
        type: '',
        pagesize: "",
        pagenum: '',
        userid: this.$route.params.userid || JSON.parse(localStorage.getItem('userinfo')).userid
      },
      dialoghyVisible: false,
      userid: '',
      nickName: '',
      dialogVisible2: false,
      companyid: '',
      companyname: ''

    }
  },
  components: {
    showLog,
    resumeDetail,
    companyDetail
  },
  props: ['type'],
  created () {
    this.allData = [{
      label: "会员名称",
      value: "name"
    }, {
      label: "手机号码",
      value: "telnum"
    },
    {
      label: "录取企业名称",
      value: "companyname"
    },
    {
      label: "个人状态",
      value: "personalstatus"
    }, {
      label: "企业状态",
      value: "companystatus"
    },
    {
      label: "入职时间",
      value: "entrydate"
    },
    {
      label: "离职时间",
      value: "offdate"
    },
    {
      label: "操作时间",
      value: "operationdate"
    },
    {
      label: "操作",
      value: "opt"
    }
    ]
    this.form.type = this.type;
    this.getData();
  },
  methods: {
    //获取列表
    getData () {
      if (!this.type) {
        return;
      }
      if (this.form.starttime && this.form.endtime && Date.parse(this.form.starttime) > Date.parse(this.form.endtime)) {
        this.$message({
          message: "结束时间不能早于开始时间",
          type: "warning"
        });
        return;
      }
      this.loading = true;
      this.form.pagesize = this.pages.pagesize;
      this.form.pagenum = this.pages.pagenum;
      this.$axios.post('/app/v1/platform/unusual/logList', this.form).then(resp => {
        if (resp.data.message === 'success.') {
          this.tableData = resp.data.data.list || [];
          this.pages.total = Number(resp.data.data.totalnum);
          this.pages.pagesize = Number(resp.data.data.pagesize);
          this.loading = false;

        }
      })
    },
    handleSizeChange (val) {
      this.pages.pagenum = 1;
      this.pages.pagesize = val;
      this.getData();
    },
    //分页查询
    ScheduleCurrentChange (val) {
      this.pages.pagenum = val;
      this.getData();
    },
    lookLog (row) {
      this.reportId = row.reportid;
      this.showLog = true;
    },
    //查询
    query () {
      this.pages.pagenum = 1;
      this.getData();
    },
    // 查看会员详情
    handleClickNickName (row) {
      this.userid = row.userid;
      this.nickName = row.name;
      this.dialoghyVisible = true;
    },
    // 查看公司详情
    handleClickCompanyName (row) {
      this.companyid = row.companyid;
      this.companyname = row.companyname;
      this.dialogVisible2 = true;
    },
    //下钻
    lowerBrick () {
      this.$router.push({
        name: 'lowerBrickList', //跳转的路径
        params: {
          type: this.type,
          userid: this.form.userid
        }
      })
    }
  },
  watch: {
    type (newVal, oldVal) {
      this.getData();
    }
  }
}
</script>
<style scoped>
.content {
  background: #fff;
  padding: 0 20px;
}
.el-row {
  padding-top: 20px;
}
.two_el_row {
  padding-top: 0px;
}
.lowerBrick {
  color: #0064e4;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 36px;
  border-radius: 18px;
  border: 1px solid #0064e4;
  padding: 0 26px;
  cursor: pointer;
  margin-bottom: 10px;
}
</style>





















